const sysConfigurationApi = new class SysConfigurationApi extends BaseApi {
    constructor() {
        super('/api/sysConfiguration')
    }

    async getAll() {
        return (await rxajax.get(super.using('/list-for-all'))).data
    }

    async listPrefix(param) {
        return (await rxajax.get(super.using('/list/prefix/' + param['prefix']))).data
    }

    async addOrUpdateBatch(arr) {
        return (await rxajax.post(super.using('/addOrUpdate/batch'), arr, {type: 'json'})).data
    }

    async getByKey(key) {
        return (await rxajax.get(super.using('/get-by-key/' + key))).data.data
    }

    async updateByKey(configKey, configValue) {
        return (await rxajax.post(super.using('/update-by-key'), new SystemConfig({
            configKey,
            configValue,
        }), {type: 'json'})).data
    }

    async getByKeyBatch(keys) {
        return (await rxajax.get(super.using('/get-by-key-batch'), keys)).data.data
    }

    async testEmail(param) {
        return (await rxajax.get(super.using('/test-email/' + param))).data
    }

    async syncNTP(param) {
        return (await rxajax.post(super.using('/ntp-sync/'), param, {type: 'json'})).data
    }
}